package com.example.service.impl;

import com.example.dao.UserDao;
import com.example.model.User;
import com.example.service.IUserService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "userService")
public class UserService implements IUserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> selectAll() {
//        PageHelper.startPage(currentPage,pageSize);
//        List<User> userList =  userDao.selectAll();
//        int countNums = userDao
        return userDao.selectAll();
    }

    @Override
    public User findUserById(Integer id) {
        return userDao.findUserById(id);
    }

    @Override
    public User session(String account, String password) {
        return userDao.session(account,password);
    }

    @Override
    public User findUserByAccount(String account) {
        return userDao.findUserByAccount(account);
    }

    @Override
    public int registerUser(User user) {
        return userDao.registerUser(user);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return userDao.deleteByPrimaryKey(id);
    }

    @Override
    public int updateByIdSelective(User user) {
        return userDao.updateByIdSelective(user);
    }
}
